<template>
    <div>
            <Card>
                <p slot="title">
				    订单审核
			    </p>
                <div>
                    <Form class="step-form" ref="orderData" :model="orderData" :label-width="100">
                       <Row span="12">
                            <i-col span="12" >
                                <FormItem label="客户名称：" label-position="left" :label-width="150">
                                    {{orderData.loginName}}
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="始发地：" label-position="left" :label-width="150">
                                    {{orderData.beginCountryName}}
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="目的地：" label-position="left" :label-width="150">
                                    {{orderData.endCountryName}}
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="发车时间：" label-position="left" :label-width="150">
                                    {{orderData.beginDate}}
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="到达时间：" label-position="left" :label-width="150">
                                    {{orderData.endDate}}
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="22">
                                <FormItem label="物流费用：" label-position="left" :label-width="150">
                                    <template>上门提车：<span style="color:red;">{{orderData.selfMentionCost}}</span></template>元&nbsp;&nbsp;&nbsp;|
                                    <template>送车上门：<span style="color:red;">{{orderData.sendCarCost}}</span></template>元&nbsp;&nbsp;&nbsp;|
                                    <template>物流费：<span style="color:red;">{{orderData.logiCost}}</span></template>元&nbsp;&nbsp;&nbsp;|
                                    <template>税费：<span style="color:red;">{{orderData.taxCost}}</span></template>元&nbsp;&nbsp;&nbsp;|
                                    <template>保险费：<span style="color:red;">{{orderData.insuranceCost}}</span></template>元&nbsp;&nbsp;&nbsp;|
                                    <template>总费用：<span style="color:red;">{{orderData.allCost}}</span></template>元
                                    
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="22">
                                <FormItem label="发车信息：" label-position="left" :label-width="150">
                                    <span>姓名：{{beginadress.username}}</span>&nbsp;&nbsp;&nbsp;|
                                    <span>联系方式：{{beginadress.userphone}}</span>&nbsp;&nbsp;&nbsp;|
                                    <span>地址：{{beginadress.provincename}}{{beginadress.cityname}}{{beginadress.areaname}}{{beginadress.address}}</span>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="22">
                                <FormItem label="收车信息：" label-position="left" :label-width="150">
                                    <span>姓名：{{endadress.username}}</span>&nbsp;&nbsp;&nbsp;|
                                    <span>联系方式：{{endadress.userphone}}</span>&nbsp;&nbsp;&nbsp;|
                                    <span>地址：{{endadress.provincename}}{{endadress.cityname}}{{endadress.areaname}}{{endadress.address}}</span>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="22">
                                <FormItem label="发票信息：" label-position="left" :label-width="150">
                                    <span>名称：{{invoice.custName}}</span>&nbsp;&nbsp;&nbsp;|
                                    <span>税号：{{invoice.taxpayerNo}}</span>&nbsp;&nbsp;&nbsp;|
                                    <span>单位地址：{{invoice.custAddr}}</span>&nbsp;&nbsp;&nbsp;|
                                    <span>联系方式：{{invoice.custPhone}}</span>&nbsp;&nbsp;&nbsp;|
                                    <span>开户银行：{{invoice.depositBank}}</span>&nbsp;&nbsp;&nbsp;|
                                    <span>账号：{{invoice.account}}</span>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="22">
                                <FormItem label="车辆信息：" label-position="left" :label-width="150">
                                    <Table border :context="self" :columns="columns7" :data="orderData.car"></Table>
                                </FormItem>
                            </i-col>
                        </Row>
                        
                        <FormItem style="margin-top:80px;">
                            <Button @click="auditSuccess" style="width:100px;" type="primary">确认</Button>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <Button @click="goIndex" style="width:100px;" >返回</Button>
                        </FormItem>
                    </Form>
                </div>
            </Card>
    </div>
</template>


<script>
import ajax from '../../../libs/axios.js'
export default {
    name: 'addUser',
    data () {
        return {
            self: this,
            columns7: [
                    {
                        title: '品牌车系',
                         align: 'center',
                        key: 'carVersion'
                    },
                    {
                        title: '估值(万元/辆)',
                        align: 'center',
                        key: 'carAmt'
                    },
                    {
                        title: '车牌号',
                        align: 'center',
                        key: 'carNum'
                    },
                    {
                        title: 'vin码',
                        align: 'center',
                        key: 'vin'
                    },
                    {
                        title: '追加额度',
                        align: 'center',
                        key: 'insuranceNm'
                    },
                    {
                        title: '保险费',
                        align: 'center',
                        key: 'insuranceAmt'
                    },
                    // {
                    //     title: '操作',
                    //     key: 'action',
                    //     width: 150,
                    //     align: 'center',
                    //     render (row, column, index) {
                    //         return `<i-button type="primary" size="small" @click="show(${index})">查看</i-button> <i-button type="error" size="small" @click="remove(${index})">删除</i-button>`;
                    //     }
                    // }
                ],
            dataCar: [],
            modal1:false,
            testModelShow:false,
            symptomList:[],
            selectModel:[],
            orderData: {},
            beginadress:{},
            endadress:{},
            invoice:{},
            hasSubmit: false,
            // 图片上传
            file: null,
            status: 'wait',
            uploadLoading: false, // 上传图片时候的加载效果,
            failreason:"",//审核失败
            id:-1,
            orderstatus:-1
        }
    },
    methods: {
        // 数据初始化
        init () {
            this.$store.commit('setActiveName', 'orderindex');
            let id = this.$route.params.id;
            let orderstatus = this.$route.params.orderstatus;
            this.id = id;
            this.orderstatus = orderstatus;

            this.orderInfo(id);
        },
        // 获取数据
        orderInfo(id){
            let _that = this;
            let url = 'adminlogin/order/selectOrderById'
            let data = {
                id: id
            }
            ajax.formRes(url, data).then(res => {
                //success
                if(200 == res.code){
                    debugger;
                    _that.orderData = res.data;
                    //_this.dataCar = _that.orderData.car;
                    _that.beginadress = res.beginadress;
                    _that.endadress = res.endadress;
                    _that.invoice = res.invoice;
                    //_that.data6 = res.data.car;
                    
                }else{
                    _that.$Message.success('数据原因，请联系管理员。')
                }      
            }).catch(res => {
                _that.$Message.success('数据原因，请联系管理员。')
                // fail
            })
        },
        // 审核成功相关数据操作
        auditSuccess () {
            //登陆成功，存储审核信息。
            let id = this.id;
            let orderstatus = this.orderstatus;
            let _that = this;
            let url = 'adminlogin/order/updateOrder'
            let data = {
                id: this.id,
                orderSign: this.orderstatus
            }
            ajax.formRes(url, data).then(res => {
                //success
                
                if(200 == res.code){
                    let argu = {}
                    _that.$router.push({
                        name: 'orderindex',
                        params: argu
                    })
                }else{
                    _that.$Message.success('数据原因，请联系管理员123123123123123。')
                }      
            }).catch(res => {
                _that.$Message.success('数据原因，请联系管理员111111。')
                // fail
            })
        },
        auditInfo () {
            this.$router.push({
                name: 'diseaseIndex'
            })
            //this.emptyData()
            
        },
        goIndex () {
            this.$Message.info('去首页');
            this.$router.push({
                name: 'orderindex'
            });
        },
        
    },
    created: function () {
        this.init()
    },
    activated: function () {
        //this.init()
    }
}
</script>
<style>
    .demo-upload-list-cover{
        display: none;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0,0,0,.6);
    }
    .card-upload:hover .demo-upload-list-cover{
        display: block;
    }
    .demo-upload-list-cover i{
        color: #fff;
        font-size: 20px;
        cursor: pointer;
        margin: 0 2px;
    }
    .demo-spin-icon-load{
        animation: ani-demo-spin 1s linear infinite;
    }
    @keyframes ani-demo-spin {
        from { transform: rotate(0deg);}
        50%  { transform: rotate(180deg);}
        to   { transform: rotate(360deg);}
    }
    .demo-spin-col{
        height: 100px;
        position: relative;
        border: 1px solid #eee;
    }
</style>

